16. Results with Merged Dataset
Results with Merged Dataset
Use the notebook below to answer the final question with the merged dataset.
Q5: For all of the models that were produced in 2008 that are still being produced now, how much has the mpg improved and which vehicle improved the most?
Here are the steps for answering this question.
1. Create a new dataframe,
model_mpg
, that contain the mean combined mpg values in 2008 and 2018 for each unique model
To do this, group by model and find the mean
cmb_mpg_2008
and mean
cmb_mpg
for each.
2. Create a new column,
mpg_change
, with the change in mpg
Subtract the mean mpg in 2008 from that in 2018 to get the change in mpg
3. Find the vehicle that improved the most
Find the max mpg change, and then use query or indexing to see what model it is!
Workspace
This section contains either a workspace (it can be a Jupyter Notebook workspace or an online code editor work space, etc.) and it cannot be automatically downloaded to be generated here. Please access the classroom with your account and manually download the workspace to your local machine. Note that for some courses, Udacity upload the workspace files onto https://github.com/udacity , so you may be able to download them there.
Workspace Information:
- Default file path:
- Workspace type: jupyter
- Opened files (when workspace is loaded): n/a